package com.yinda.dt.produce.view;

import android.app.Dialog;
import android.content.Context;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.yinda.dt.produce.R;

/**
 * 进度对话框
 * <br/>
 * Created by 小灿 on 2017/3/9.
 */

public class ProgressDialog extends Dialog {

    private TextView tv_title;
    private ProgressBar pb_progress;
    private TextView tv_progress;

    public ProgressDialog(Context context) {
        super(context, R.style.MyDialog);

        setContentView(R.layout.dialog_progress);

        tv_title = (TextView) findViewById(R.id.tv_title);
        pb_progress = (ProgressBar) findViewById(R.id.pb_progress);
        pb_progress.setMax(100);
        tv_progress = (TextView) findViewById(R.id.tv_progress);

        this.setCanceledOnTouchOutside(false);
    }

    public void setTitle(CharSequence content) {
        tv_title.setText(content);
    }

    public void setProgress(int progress) {
        pb_progress.setProgress(progress);
        tv_progress.setText(progress + "%");
    }

}
